<!DOCTYPE HTML>
<html lang="zh-cn" ng-app="ExpressionTest">
<head>
    <meta charset="UTF-8">
    <title>expression-e1</title>
    <style type="text/css">
        .ng-cloak {
            display: none;
        }
    </style>
</head>
<body ng-controller="MyCtrl">
1 + 2 = {{1+2}}
<br/>
Expression:
<input type="text" ng-model="expr"/>
<button ng-click="addExp(expr)">Evaluate</button>
<ul>
    <li ng-repeat="expr in exprs">
        [<a ng-click="removeExp($index)" href="">X</a>]
        <tt>{{expr}}</tt>=><span ng-bind="$parent.$eval(expr)"></span>
    </li>
</ul>
<script src="../angular-1.0.1.js" type="text/javascript"></script>
<script type="text/javascript">
    var app = angular.module("ExpressionTest", []);
    app.controller("MyCtrl", function ($scope) {
        var exprs = $scope.exprs = [];
        $scope.expr = "3*10|currency";
        $scope.addExp = function(expr) {
            exprs.push(expr);
        };
        $scope.removeExp = function (index) {
            exprs.splice(index, 1);
        };
    });
</script>
</body>
</html>